package com.xiaobai.dynamics.config;
 
import com.xiaobai.dynamics.domin.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
public class TestEventPublisher {

    private final ApplicationEventPublisher publisher;

    @Autowired
    public TestEventPublisher(ApplicationEventPublisher publisher) {
        this.publisher = publisher;
    }
 
    public void publishTestEvent(String message, Test test) {
        TestEvent event = new TestEvent(this, message, test);
        publisher.publishEvent(event);
    }
}